package com.open.capacity.service.impl;

import com.open.capacity.mapper.LoginMapper;
import com.open.capacity.model.BusinessData;
import com.open.capacity.model.LoginModel;
import com.open.capacity.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: y_022
 * @date: 11:37-2021/6/26
 * @description:
 */
@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginMapper loginMapper;
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
    @Override
    public BusinessData login(LoginModel loginModel) {
        BusinessData businessData = loginMapper.login(loginModel);
        return businessData;
    }

    @Override
    public int findUserByPhones(String phones) {
      return   loginMapper.findUserByPhones(phones);
    }

    @Override
    public int findUserByEmails(String Emails) {
        return  loginMapper.findUserByEmails(Emails);
    }

    @Override
    public int findUserByNumber(String number) {
        return  loginMapper.findUserByNumber(number);
    }

//    @Override
//    public void register(BusinessData businessData) {
//        businessData.setPasswd(DigestUtils.md5DigestAsHex(businessData.getPasswd().getBytes()));
//        loginMapper.register(businessData);
//        rabbitTemplate.convertAndSend("mailTopicExchange","mail.a",businessData.getEmails()); //消息交换机向符合routingKey的消息队列发送消息
//    }
}
